# 日志模块
import os
import platform
import logging

if platform.platform().startswith("Windows"):
    logging_file = os.path.join(os.getenv("HOMEDRIVE"), os.getenv("HOMEPATH"), 'test.log')
else:
    logging_file = os.path.join(os.getenv("HOME"), 'test.log')

print("logging to file : ", logging_file)

logging.basicConfig(
    filename=logging_file,
    level=logging.DEBUG,
    filemode='w',
    format='%(asctime)s : %(levelname)s : %(message)s'
)
logging.debug("start")
logging.info("do something")
logging.warn("dying now")
